package com.zxy.salenet.web.mapper;

import com.zxy.salenet.web.pojo.SalenetGoods;
import com.zxy.salenet.web.pojo.SalenetOrgin;
import com.zxy.salenet.web.pojo.SalenetType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
 /**
   *  SalenetTypeMapper。
     */
public interface SalenetTypeMapper extends Mapper<SalenetType> {

    /**
     * 添加商品类别
     * @param salenetType
     * @return
     */
    @Insert(value = "INSERT INTO salenet_type VALUES(default,#{typeId},#{typeName},#{typeParentId})")
    Integer addGoodsType(SalenetType salenetType);

    /**
     * 获取所有的商品分类列表
     * @return
     */
    @Select(value = "SELECT * FROM salenet_type")
    List<SalenetType> selectAllGoods();

    /**
     * 获取父级类别信息
     * @param typeParentId
     * @return
     */
    @Select(value = "SELECT * FROM salenet_type WHERE type_id = #{typeParentId}")
    SalenetType selectGoodsByTid(@Param("typeParentId") Integer typeParentId);

    /**
     * 获取所有的父级商品信息
     * @return
     */
    @Select(value = "SELECT * FROM salenet_type WHERE type_parent_id = 0")
    List<SalenetType> selectParentAll();

    /**
     * 添加商品品牌信息
     * @param orgin
     * @return
     */
    @Insert(value = "INSERT INTO salenet_orgin VALUES(default,#{orginId},#{orginName},#{orginComm})")
    Integer insertOrgin(SalenetOrgin orgin);

    /**
     * 删除对应品牌数据
     * @param orginId
     * @return
     */
    @Delete(value = "DELETE FROM salenet_orgin WHERE orgin_id = #{orginId}")
    Integer deleteOrginById(@Param("orginId") Integer orginId);

    /**
     * 添加商品信息
     * @param goods
     * @return
     */
    @Insert(value = "INSERT INTO salenet_goods VALUES(default,#{goodsId},#{goodsName},#{goodsType},#{goodsPrice},#{goodsSellingPrice},#{goodsOrgin},#{goodsBrand},#{goodsTimes},#{goodsPutaway},#{goodsCount},#{goodsAuthCode},#{goodsImg},#{goodsDescribed},#{goodsStatus})")
    Integer addGoods(SalenetGoods goods);
    /**
     * 完成
     */
}